package com.kaibes.module.permission.db.listener;

import org.springframework.stereotype.Component;

import com.kaibes.module.permission.db.entity.Role;
import com.kaibes.module.permission.db.service.RoleService;
import com.kaibes.orm.spring.TableInitialize;

@Component
public class RoleEmptyListener extends TableInitialize<RoleService> {

    @Override
    public void onEmpty(RoleService service) {
        Role role = new Role();
        role.setName("普通用户");
        role.setRemark("默认的注册用户角色");
        role.setSort(1);
        service.save(role);
        
        role = new Role();
        role.setName("系统管理员");
        role.setRemark("默认的管理员角色");
        role.setSort(2);
        service.save(role);
    }

}
